package com.lsu.app.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lsu.app.bean.StudyLog;
import com.lsu.app.service.StudyLogService;
import com.lsu.app.mapper.StudyLogMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;
import java.util.List;

/**
 *
 * @description 针对表【study_log(学习记录)】的数据库操作Service实现
 * @Date 2023-11-07 18:27:02
 * @author hjj
 */

@Service
public class StudyLogServiceImpl extends ServiceImpl<StudyLogMapper, StudyLog> implements StudyLogService{
    private final StudyLogMapper mapper;

    public StudyLogServiceImpl(StudyLogMapper mapper) {
        this.mapper = mapper;
    }

    @Override
    public String getTimeStringById(Integer id) {
        return mapper.getTimeStringById(id);
    }

    @Override
    public List<StudyLog> getStudyLogByUserId(Integer userId) {
        return mapper.getStudyLogByUserId(userId, LocalDate.now().plusDays(-14).toString());
    }
}




